package com.hospital.service.project.model.param;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hospital.service.project.entity.ProInfoBase;
import com.hospital.service.project.entity.help.ProInfoBaseHelp;
import enhance.plus.util.LogRecording;
import enhance.plus.util.MybatisPlusUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * 实验项目基本表 新增参数
 *
 * @author xhl
 * @created 2020-10-10 13:58:34
 */
@Data
@ToString
@Accessors(chain = true)
@ApiModel(value="ProInfoBase[实验项目基本表]入参")
public class ProInfoBaseSaveSonParam extends LogRecording {

    /**
     * 子项目检索编号
     */
    @ApiModelProperty(value = "项目检索编号", required = false , example = "")
    private String projectNumber;

    /**
     * 子项目名称
     */
    @ApiModelProperty(value = "子项目名称", required = false , example = "")
    private String projectName;

    /**
     * 子项目概述
     */
    @ApiModelProperty(value = "子项目概述", required = false , example = "")
    private String summary;

    /**
     * 子项目关键词
     */
    @ApiModelProperty(value = "子项目关键词", required = false , example = "")
    private String keyword;

    /**
     * 样本总数
     */
    @ApiModelProperty(value = "样本总数", required = false , example = "")
    private String samplesTotalNumber;

    /**
     * 样本种属
     */
    @ApiModelProperty(value = "样本种属", required = false , example = "")
    private String sampleSpecies;

    /**
     * 样本类型
     */
    @ApiModelProperty(value = "样本类型", required = false , example = "")
    private String sampleType;

    /**
     * 父项目编号
     */
    @ApiModelProperty(value = "父项目编号", required = true, example = "PSD00001")
    private String superiorProjectNumber;

    /**
     * 子项目实施人
     */
    @ApiModelProperty(value = "实施人编号", required = false, example = "")
    private List<String> implementerNumbers;

    /**
     * 把非 null 的值 转换成一个 查询条件
     * @return
     */
    public QueryWrapper<ProInfoBase> convertParamToQueryWapper(){
        QueryWrapper<ProInfoBase> query = ProInfoBaseHelp.createQuery();
        Map<String, Object> result =  MybatisPlusUtil.convertParamToMap(this, ProInfoBase.class);
        query.allEq(result);
        return query;
    }
}
